package com.ylr;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @ClassName TestApplication
 * @Description TODO
 * @Author 11
 * @Date 2021/6/1 20:15
 * @Version 1.0
 */
@SpringBootApplication
//@EnableScheduling
//@EnableAsync
public class TestApplication {
    public static void main(String[] args) {
        SpringApplication.run(TestApplication.class ,args) ;
    }

    /**
     * 异步线程池设置
     * 如果所有的任务都使用异步，线程池执行的话，可以不配置同步任务线程池。但是使用异步需要注意的是异步线程池的大小配置。异步的线程池默认是无上限的开启线程数的。
     * @return
     */
//    @Bean
//    SimpleAsyncTaskExecutor simpleAsyncTaskExecutor(){
//        SimpleAsyncTaskExecutor simpleAsyncTaskExecutor = new SimpleAsyncTaskExecutor();
//        simpleAsyncTaskExecutor.setConcurrencyLimit(7);  //设置最大并行数
//        simpleAsyncTaskExecutor.setDaemon(true);  //设置为守护线程
//        return  simpleAsyncTaskExecutor;
//    }


}
